package Exists;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HashMap_KV {
    public static void main(String[] args) {


        String res = "ijflkjdnfkjngedkljtdfjbngljtgnhsbtgbjnsltkgh";

        HashMap<Character, Integer> map = new HashMap<>();


        for (int i = 0; i < res.length(); i++) {
            Character a = res.charAt(i);
            if (map.containsKey(a)) {
                Integer num = map.get(a);
                num++;
                map.put(a, num);
            } else {

                map.put(a, 1);
            }

        }
        Set<Map.Entry<Character, Integer>> entries = map.entrySet();
        for (Map.Entry<Character, Integer> entry : entries) {
            Character key = entry.getKey();
            Integer vaule = entry.getValue();
            System.out.println("重复的字符" + key + "重复的次数" + vaule);
        }


    }
}




